package com.yitiao.controller;

import com.yitiao.entity.CommerceGoods;
import com.yitiao.service.CommerceGoodsService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/goods")
@AllArgsConstructor
public class GoodsController {

    private final CommerceGoodsService goodsService;

    @PostMapping("/add")
    public void addGoodsAsync(@RequestBody List<CommerceGoods> goods){
        goodsService.batchInsert(goods);
    }

    @PostMapping("/tran/add")
    public void addGoodsTran(@RequestBody List<CommerceGoods> goods){
        goodsService.addGoodsTran(goods);
    }

}
